package main

import (
	"fmt"
	"gitee.com/nacos.demon/nacosGo/client"
)

func main() {
	option:=client.NewOption().WithAdress("123.56.24.220").WithPort(8848)
	nacosClient:=client.NewNacos(option)
	if ok:=nacosClient.Publish("test","test","hello word");ok{
		fmt.Println("Nacos 配置列表")
	}
	content:=nacosClient.Get("test","test")
	fmt.Println("Nacos 配置内容:",content)
	if err:=nacosClient.Listen("test","test", func(namespace, group, dataId, data string) {
		fmt.Println("监听修改修改配置:",data)
	});err!=nil{
		panic(err)
	}
	if ok:=nacosClient.Delete("test","test");ok{
		fmt.Println("删除配置成功")
	}
	if ok :=nacosClient.Register("10.4.176.26",9000);ok{
		fmt.Println("注册服务成功")
	}
}
